<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./node_modules/_vue@2.5.22@vue/dist/vue.js"></script>
    <script src="./lib/vue-resource-1.3.4.js"></script>
</head>
<body>
    <div class="app">
        <input type="button" value="get请求" @click='getInfo'>
        <input type="button" value="post请求" @click='postInfo'>
        <input type="button" value="get请求" @click='jsonpInfo'>
    </div>

   
    <script>
        const url='http://www.liulongbin.top:3005';
        var a = new Vue({
            //el指向需要控制的元素
            el: '.app',
            //data 存放数据;
            data: {
            },
            methods:{
                getInfo(){
                    //
                    this.$http.get(url+'/api/getlunbo').then(function(res){
                        console.log(res.body);
                    })
                },
                postInfo(){
                    this.$http.post(`${url}/api/post`,{},{ emulateJSON: true }).then((res)=>{
                        console.log(res.body)
                    })
                },
                jsonpInfo(){
                    this.$http.jsonp(url+'/api/jsonp').then((res)=>{
                        console.log(res.body)
                    })
                },
            }
        })
    </script>
</body>
</html>